package com.microframework.base.core.exception;

public class ConfigParseException extends RuntimeException {

	private static final long serialVersionUID = 1L;

	/**
	 * 错误码
	 */
	private Integer code;

	/**
	 * 错误消息
	 */
	private String message;

	private Exception exception;

	/**
	 * 创建未授权异常
	 * 
	 * @param message 错误消息
	 */
	public ConfigParseException(String message) {
		super(message);
		this.code = 500;
		this.message = message;
	}

	/**
	 * 创建未授权异常
	 * 
	 * @param code    错误码
	 * @param message 错误消息
	 */
	public ConfigParseException(Integer code, String message) {
		super(message);
		this.code = code;
		this.message = message;
	}

	public ConfigParseException(String message, Exception e) {
		this.message = message;
		this.exception = e;
	}

	/**
	 * 获取错误码
	 * 
	 * @return 错误码
	 */
	public Integer getCode() {
		return code;
	}

	/**
	 * 获取错误消息
	 * 
	 * @return 错误消息
	 */
	@Override
	public String getMessage() {
		return message;
	}

	public Exception getException() {
		return exception;
	}

}
